/**
 * 
 */
package org.gkolpu.validation.oval.basetypes;

import java.io.Serializable;

import net.sf.oval.constraint.Length;
import net.sf.oval.constraint.MatchPattern;
import net.sf.oval.constraint.MaxLength;
import net.sf.oval.constraint.NotEmpty;
import net.sf.oval.constraint.NotNull;

public class Address implements Serializable {

	@NotNull(errorCode = "address.addressLine1.notNull", profiles = { "MYPROFILE" })
	@NotEmpty(errorCode = "address.addressLine1.notNull", profiles = { "MYPROFILE" })
	@MaxLength(errorCode = "address.addressLine1.length", value = 100, profiles = { "MYPROFILE" })
	private String addressLine;

	@Length(errorCode = "address.countryCode.length", min = 2, max = 2, profiles = { "MYPROFILE" })
	private String country;

	@MaxLength(errorCode = "address.city.length", value = 35, profiles = { "MYPROFILE" })
	private String city;

	@Length(errorCode = "address.state.length", min = 2, max = 2, profiles = { "MYPROFILE" })
	@MatchPattern(errorCode = "address.state.alpha.characters.matchPattern", pattern = "^[A-Za-z]+$", profiles = { "MYPROFILE" })
	private String state;

	@NotNull(errorCode = "address.zip.notNull", profiles = { "MYPROFILE" })
	@NotEmpty(errorCode = "address.zip.notNull", profiles = { "MYPROFILE" })
	private String zip;

	public Address(String addressLine, String country, String city,
			String state, String zip) {
		super();
		this.addressLine = addressLine;
		this.country = country;
		this.city = city;
		this.state = state;
		this.zip = zip;
	}

	@Override
	public String toString() {
		return "Address [addressLine=" + addressLine + ", country=" + country
				+ ", city=" + city + ", state=" + state + ", zip=" + zip + "]";
	}

	public String getAddressLine() {
		return addressLine;
	}

	public void setAddressLine(String addressLine) {
		this.addressLine = addressLine;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getZip() {
		return zip;
	}

	public void setZip(String zip) {
		this.zip = zip;
	}

}
